import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:drm/http/date_result.dart';
import 'package:drm/http/http_url.dart';
import 'package:drm/http/action.dart';

import 'package:drm/gdfk/azd/azd_bloc.dart';
import 'package:drm/gdfk/azd/azd_mx_entity.dart';
/*
 * State
 */
class ListState {

}



class InitialListState extends ListState {}

class NullState extends ListState {}

class RefreshState<T> extends ListState {
  int total;
  List<T> items ;
  bool isSuccess;
  String message;
  RefreshState(this.total, this.items,{this.isSuccess,this.message}):super();

}

 class ListEvent {
   Map<String,String> params ;
   String portUrl;
   ListEvent({this.params, this.portUrl});

   Future<DateResult<Map>> getListHandTotalData<T>() async {
     print('T运行时的Type${T.runtimeType}');
     return await ActionDo.getListDateHandTotal<T>(params, postUrl: portUrl);
   }

   Future<DateResult<List<T>>> getListData<T>() async {
     return await ActionDo.getDate<T>(params, postUrl: portUrl);
   }

   Future<DateResult<T>> getInfoDate<T>() async {
     return await ActionDo.getInfoDate<T>(params, postUrl: portUrl);
   }

 }
class NullEvent extends ListEvent{

}


class RefreshListEvent<T> extends ListEvent {
  String portUrl;
  RefreshListEvent(params,{this.portUrl}) :super(params:params,portUrl:portUrl) ;
  Future<DateResult<Map>> getList() async {
    return await ActionDo.getListDateHandTotal<T>(params, postUrl: portUrl);
  }
}

class RefreshEvent extends ListEvent {

}


  class ListBloc extends Bloc<ListEvent, ListState> {
  @override
  ListState get initialState => InitialListState();

  @override
  Stream<ListState> mapEventToState(
      ListEvent event,
  ) async* {
    //空状态。用于，避免刷新 ；


  }


 }
